/* ===========================================
 * 标签组件样式 - 精简版
 * =========================================== */

/* --------- 标签视图容器 --------- */
.tags-view-container {
  border-bottom: 1px solid var(--color-border);
  padding: 8px 16px 0;
  position: relative;
  width: 100%;
}

/* --------- 滚动轨道容器 --------- */
.tags-track {
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* --------- 滚动容器 --------- */
.tags-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 20px;
  align-items: center;
  min-height: 40px;

  &::-webkit-scrollbar {
    display: none;
  }
}

/* --------- 现代化标签样式 --------- */
.n-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  height: 28px;
  margin-right: 4px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  white-space: nowrap;

  /* 内部高光效果 */
  &::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    height: 50%;
    border-radius: 13px 13px 6px 6px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent);
    opacity: 0.5;
    transition: opacity 0.22s ease;
  }

  /* --------- 悬停效果 --------- */
  &:hover:not([type='primary']) {
    color: var(--color-primary) !important;
    border-color: var(--color-primary);
    transform: scale(1.02);

    &::before {
      opacity: 0.8;
    }

    /* 图标颜色同步 - 强制覆盖 */
    :deep(.c-icon),
    :deep([class*="c-icon"]) {
      color: var(--color-primary) !important;
    }

    /* 兼容其他图标 */
    i, .icon {
      color: var(--color-primary) !important;
    }

    /* 关闭按钮在标签悬停时的样式 */
    :deep(.n-tag__close) {
      color: var(--color-primary) !important;
      opacity: 0.8;
      transform: scale(1.05);
    }
  }

  /* --------- 激活状态 --------- */
  &[type='primary'] {
    background: var(--tag-active-bg, rgba(32, 128, 240, 0.08)) !important;
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    font-weight: 600;
    transform: scale(1.02);

    &::before {
      opacity: 0.6;
    }

    /* 强制覆盖文字颜色 */
    :deep(.n-tag__content),
    :deep(*:not(.n-tag__close)) {
      color: var(--color-primary) !important;
    }

    /* 激活状态的图标颜色 */
    :deep(.c-icon),
    :deep([class*="c-icon"]) {
      color: var(--color-primary) !important;
    }

    /* 兼容其他图标 */
    i, .icon {
      color: var(--color-primary) !important;
    }

    /* 激活状态悬停 */
    &:hover {
      background: var(--tag-active-hover-bg, rgba(32, 128, 240, 0.12)) !important;
      transform: scale(1.03);
    }

    /* 激活状态关闭按钮 */
    :deep(.n-tag__close) {
      color: var(--color-primary) !important;
      opacity: 0.8;
    }
  }

  /* --------- 精致的关闭按钮样式 --------- */
  :deep(.n-tag__close) {
    width: 16px !important;
    height: 16px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid transparent;

    /* 悬停前的初始状态 */
    &:not(:hover) {
      transform: scale(0.9);
    }

    /* 悬停时的精致红色效果 */
    &:hover {
      background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(239, 68, 68, 0.08)) !important;
      border-color: rgba(239, 68, 68, 0.15) !important;
      color: #ef4444 !important;
      opacity: 1 !important;
      transform: scale(0.6) !important;
      box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2) !important;
    }

    /* 点击时的效果 */
    &:active {
      transform: scale(0.95) !important;
      transition-duration: 0.1s !important;
    }
  }
}

/* --------- C_Icon 组件样式 --------- */
:deep(.c-icon) {
  margin-right: 4px;
  font-size: 12px;
  transition: color 0.22s ease;
  display: inline-flex;
  align-items: center;
}

/* --------- 响应式设计 --------- */
@media (max-width: 768px) {
  .tags-view-container {
    padding: 6px 12px 0;
  }

  .n-tag {
    height: 26px;
    padding: 0 10px;
    font-size: 11px;
    margin-right: 3px;
    border-radius: 13px;

    :deep(.n-tag__close) {
      width: 14px;
      height: 14px;
      font-size: 11px;
      margin-left: 4px;
    }
  }

  .tags-container {
    padding: 0 12px;
    min-height: 36px;
  }

  :deep(.c-icon) {
    font-size: 11px;
    margin-right: 3px;
  }
}

/* --------- 暗色主题适配 --------- */
[data-theme='dark'] {
  .n-tag {
    :deep(.n-tag__close) {
      background: rgba(255, 255, 255, 0.03) !important;

      &:hover {
        background: linear-gradient(135deg, rgba(248, 113, 113, 0.12), rgba(239, 68, 68, 0.1)) !important;
        box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25) !important;
      }
    }
  }
}
